/* 

控制器层引入路径
const model  = require('../../dao/model/model');
*/


const {mongoose ,Schema} = require('../daoconfig.js');
const {code_shenti}  = require('../../code/code_shenti.js');

const {code_check_state}  = require('../../code/code_check_state.js');
const {code_fatishenfen}  = require('../../code/code_fatishenfen.js');

// 题目
const {titleschema}  = require('../schema/title/index.js');

// 做题记录
const {do_titles_logs_schema}  = require('../schema/do_titles_logs/index.js');

// 招聘信息
const {job_schema}  = require('../schema/jobs/index.js');

// 用户角色和权限
const {userRoles_schema}  = require('../schema/userRoles_schema/index.js');

// 用户
const {userschema}  = require('../schema/user/index.js');

// 用户定位职业表
const {locationProfession}  = require('../schema/locationProfession/index.js');

// 角色
const {role_schema}  = require('../schema/role_schema/index.js');

// 权限
const {auth_schema}  = require('../schema/auth_schema/index.js');

// 公司
const {company_schema}  = require('../schema/company_schema/index.js');

// 知识点
const {pointSchema}  = require('../schema/pointSchema/index.js');

// 用户的科目评分
const {userAndKemuScore_schema}  = require('../schema/userAndKemuScore_schema/index.js');

// 收藏
const {favoriteSchema}  = require('../schema/favoriteSchema/index.js');

const {JobDesireSchema}  = require('../schema/JobDesireSchema/index.js');

// 简历
const {resumeSchema}  = require('../schema/resumeSchema/index.js');


// 学科
const {xueke_schema}  = require('../schema/xueke/index.js');

// 科目
const {kemuSchema}  = require('../schema/kemuSchema/index.js');

// 方向
const {direction}  = require('../schema/direction/index.js');

// 职业
const {profession}  = require('../schema/profession/index.js');

// 题目类型
const {tittleType}  = require('../schema/tittleType/index.js');

// 行业
const {industry}  = require('../schema/industry/index.js');

// 段位
const {surface_rank}  = require('../schema/surface_rank/index.js');

// 赛季
const {stageSchema}  = require('../schema/stageSchema/index.js');

// 省
const {addressShengSchema}  = require('../schema/addressShengSchema/index.js');

// 学历
const {education_schema}  = require('../schema/education_schema/index.js');
// 市级
const {shiji_schema}  = require('../schema/addressShijiSchema/index.js');
// 区县级
const {quxian_schema}  = require('../schema/addressQuxianSchema/index.js');

// 简历信箱
const {resumeBoxSchema} = require('../schema/resumeBoxSchema/index.js');


































//#region  用户知识点熟练度
const userPointScore_schema = new Schema({
	userid:{type:Schema.Types.ObjectId,ref: 'user'},
	pointid:{type:Schema.Types.ObjectId,ref: 'point'},
	// 熟练度
	pointScore:Number,
	// 赛季
	stage:{type:Schema.Types.ObjectId,ref: 'stage'},
	  });
//#endregion









//#region  用户扩展信息
const  user_extend_info = new Schema({
		phone:String,
		qq:String,
		weixin:String,
		email:String,
		adress:String,
		// 性别
		gender:Number,
  });
//#endregion


//#region  提问
const topic = new Schema({
	userid:{type:Schema.Types.ObjectId,ref: 'user'},
	topic_head :String,
	topic_body :String,
	topic_professionid:{type:Schema.Types.ObjectId,ref: 'profession'},
	topic_kemuid:{type:Schema.Types.ObjectId,ref: 'kemu'},
	topic_pointid:{type:Schema.Types.ObjectId,ref: 'point'},
	topic_time:{ type: Date, default: Date.now }
	  });


	  //#endregion





//#region  学科和科目中间表
const xuekeAndKemu = new Schema({
	xuekeId: Schema.Types.ObjectId,
	kemuId:  Schema.Types.ObjectId
	  });	

	  //#endregion



//#region 参与审题表
const check_title=({
	tittleid:{type:Schema.Types.ObjectId,ref: 'tittle'},
	userid:{type:Schema.Types.ObjectId,ref:'user'},
	// 该用户,在这条审题记录里的身份
	identity:{type:Number,default:code_fatishenfen.initshenfen},
	// 审题状态(该用户,有没有确认审题通过)
	check_state:{type:Number,default:code_check_state.initstate},
	// 确认时间
	confirm_time:{ type: Date},
	// 参与审题的时间
	publishdate:{ type: Date, default: Date.now},
	});


//#endregion

	//#region   审题留言记录

	const check_title_content_schema = new Schema({
		tittleid:{type:Schema.Types.ObjectId,ref: 'tittle'},
		userid:{type:Schema.Types.ObjectId,ref:'user'},
		// 该用户,在这条审题记录里的身份
		identity:{type:Number,default:code_fatishenfen.initshenfen},
		// 留言内容
		content:String,
		// 留言时间
		leave_content_time:{ type: Date, default: Date.now}
		


		});


		//#endregion

	//#region  题目评论
	const commentschema = new Schema({
	uid: {type:Schema.Types.ObjectId,ref: 'user'},
	tittleid:{type:Schema.Types.ObjectId,ref: 'tittle'},
	content:String,
	publishdate:Date
	});

	//#endregion

	//#region  提问的评论
	const topic_comment_schema = new Schema({
		uid: {type:Schema.Types.ObjectId,ref: 'user'},
		topicid:{type:Schema.Types.ObjectId,ref: 'topic'},
		content:String,
		publishdate:Date
		});

		//#endregion

	





	







	  //#region  职业类型
	  const professionType=new Schema({
		//职业名
		professionTypeName:String,
	   //职业描述
	   professionTypeDesc:String
	 });
	 //#endregion





		const tittlePoint=new Schema({
			/* 题目ID*/
			tittleid:{ type: Schema.Types.ObjectId, ref: 'tittles' },
			/* 知识点ID */
			pointid:{ type: Schema.Types.ObjectId, ref: 'point' }
			/* 知识点描述 */
		});




				const plan=new Schema({
					/* 用户id*/
					userid:{ type: Schema.Types.ObjectId },
					/* 职业id */
					professionid:{ type: Schema.Types.ObjectId},
					/* 计划数目 */
					name:String,
					num:Number,
				});


	 
	  


//#region  model
/* 
const modelTittleType=mongoose.model('aaa',doitem,'bbb') 
modelTittleType - 模型名
mongoose.model -创建模型
aaa -  模型名
doitem -定义的约束
bbb -关联的表
*/

// 简历
const resumeModel=mongoose.model('resume',resumeSchema,'resume') 

const resumeBoxModel=mongoose.model('resumeBox',resumeBoxSchema,'resumeBox')


// 求职期望
const JobDesireModel=mongoose.model('JobDesire',JobDesireSchema,'JobDesire') 
// 用户角色表
const userRoles_model=mongoose.model('userRoles',userRoles_schema,'userRoles') 

// 角色
const role_model=mongoose.model('role',role_schema,'role') 

// 权限
const auth_model=mongoose.model('auth',auth_schema,'auth') 




// 学历
const education_model=mongoose.model('education',education_schema,'education') 


/* 工作 */
const job_schema_model=mongoose.model('job',job_schema,'job') 


/* 公司 */
// const company_certificate_model=mongoose.model('company_certificate',company_certificate_schema,'company_certificate') 



/* 区县级 */
const quxian_model=mongoose.model('quxian',quxian_schema,'quxian') 

/* 市级 */
const shiji_model=mongoose.model('shiji',shiji_schema,'shiji') 

/* 省级 */
const address_model=mongoose.model('address',addressShengSchema,'address') 

// 公司
const company_model=mongoose.model('company',company_schema,'company') 

// 方向
const directionModel=mongoose.model('direction',direction,'direction') 
// 学科
const xuekeModel=mongoose.model('xueke',xueke_schema,'xueke') 
// 科目
const modelkemu=mongoose.model('kemu',kemuSchema,'kemu')
// 学科和科目中间表
const xuekeAndKemuModel=mongoose.model('xuekeAndKemu',xuekeAndKemu,'xuekeAndKemu') 
	// 用户
	const usermodel = mongoose.model('user',userschema)

	// 评论
	const comment = mongoose.model('comment',commentschema)
	// 题目
	const titlemodel = mongoose.model('tittle',titleschema)
	
	
	// 收藏
	const favoritemodel = mongoose.model('favorite',favoriteSchema)
	// const englishwordmodel = mongoose.model('englishword',englishword)
	/* 做题 */
	const modeldoitem=mongoose.model('doitem',do_titles_logs_schema,'doitem')
	/*题目类型 */
	const modelTittleType=mongoose.model('tittleType',tittleType,'tittleType')
	/* 职业 */
	const modelProfession=mongoose.model('profession',profession,'profession')
	/* 职业-类型 */
	const modelprofessionType=mongoose.model('professionType',professionType,'professionType')
	/* 职业-职能 */
	// const modelproFunction=mongoose.model('proFunction',proFunction,'proFunction')
	/* 行业 */
	const modelindustry=mongoose.model('industry',industry,'industry')
	/* 职能-行业相关性 */
	// const modelfuncIdustryRelative=mongoose.model('funcIdustryRelative',funcIdustryRelative,'funcIdustryRelative')
	/* 职业-行业相关性 */
	// const modelprofessionIndustryRelative=mongoose.model('professionIndustryRelative',professionIndustryRelative,'professionIndustryRelative')
	/* 职能-职业相关性 */
	// const modelprofessionFunctionRelative=mongoose.model('professionFunctionRelative',professionFunctionRelative,'professionFunctionRelative')

	/* 科目-职业 */
	// const modelkemuZhiye=mongoose.model('kemuZhiye',kemuZhiye,'kemuZhiye')
	/* 知识点 */
	const modelpoint=mongoose.model('point',pointSchema,'point')
	/* 知识点-题目中间表 */
	const modelpointTittle=mongoose.model('tittlePoint',tittlePoint,'tittlePoint')
	/* 用户--定位职业 */
	const modellocationProfession=mongoose.model('locationProfession',locationProfession,'locationProfession')
	/* 用户--职业默认科目 */
	// const modeldefaultKemu=mongoose.model('defaultKemu',defaultKemu,'defaultKemu')
	/* 用户--做题计划 */
	const modelplan=mongoose.model('plan',plan,'plan')
	// 针对题目的提问
	// const modelquesToTitle=mongoose.model('quesToTitle',quesToTitle,'quesToTitle')

	// 提问
	const model_topic=mongoose.model('topic',topic,'topic')

	// 审题记录
	const model_check_title=mongoose.model('check_title',check_title,'check_title')

	// 提问 评论
	const model_topic_comment=mongoose.model('topic_comment_schema',topic_comment_schema,'topic_comment_schema')

	// 表面等级
	const surface_rank_model=mongoose.model('surface_rank',surface_rank,'surface_rank')

	// 赛季
	const stage_model=mongoose.model('stage',stageSchema,'stage')
	// 用户和知识点熟练度
	const userPointScore_model=mongoose.model('userPointScore',userPointScore_schema,'userPointScore')
	// 用户和科目评分
	const userAndKemuScore_model=mongoose.model('userAndKemuScore',userAndKemuScore_schema,'userAndKemuScore')
				// 审题留言内容
	const check_title_content_model=mongoose.model('check_title_content',check_title_content_schema,'check_title_content')
	
	
	
	
	
	

	


	

/* model写后，不用注册到daoenter */	

//#endregion
	

	

//新定义的模型，记得在这里导出
//新定义的模型，记得创建新的文件夹，并且把文件导入到daoenter.js
module.exports={
	resumeBoxModel,
	resumeModel,
	JobDesireModel,
	userRoles_model,
	role_model,
	auth_model,
	education_model,
	job_schema_model,
	company_model,
usermodel,comment,titlemodel,
favoritemodel,modeldoitem,modelTittleType,modelProfession,modelprofessionType,modelindustry,modelkemu
,modelpoint,modelpointTittle,modellocationProfession,modelplan,xuekeModel,xuekeAndKemuModel,directionModel
,model_topic,model_check_title,model_topic_comment,surface_rank_model,stage_model,userPointScore_model,userAndKemuScore_model,check_title_content_model
,address_model,quxian_model,shiji_model
}
